package com.shj.service.impl;

import com.shj.dao.SysExpensesMapper;
import com.shj.entity.SysExpenses;
import com.shj.service.SysExpensesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author songhuajian
 * @Description: TODO
 * @date 2020/6/17 21:55
 **/
@Service
public class SysExpensesServiceImpl implements SysExpensesService {
    @Autowired
    private SysExpensesMapper sysExpensesMapper;

    @Override
    public List<SysExpenses> findAll() {
        return sysExpensesMapper.findAll();
    }

    @Override
    public SysExpenses findById(Integer id) {
        return sysExpensesMapper.selectByPrimaryKey(id);
    }

    @Override
    public void add(SysExpenses sysExpenses) {
        sysExpensesMapper.insert(sysExpenses);
    }

    @Override
    public void edit(SysExpenses sysExpenses) {
        sysExpensesMapper.updateByPrimaryKey(sysExpenses);
    }

    @Override
    public BigDecimal sumFree(String perCode) {
        return sysExpensesMapper.sumFree(perCode);
    }
}
